// const { ethers } = require("hardhat");

async function main() {
  const [owner] = await ethers.getSigners();

  // NFT合约地址
  const contractAddress = "0x3E792475f3E68Ef5D24E8B4a49f1C9AF8186b4fa"; 

  const MyNFT = await ethers.getContractFactory("MyNFT");
  const mynft = await MyNFT.attach(contractAddress).connect(owner);

  // 查看nextTokenId的值
  const id = await mynft.nextTokenId();
  console.log("nextTokenId =", id.toString());

  // mint一个NFT
  // const tx = await mynft.mint(owner.address);
  let to_address = "0x5324068f68C1EBDf3aD5Fa15b3aA2Cd92540942A";
  const tx = await mynft.mint(to_address);

  await tx.wait();

  console.log("tx info: ", tx);
  console.log("mint成功");
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});
